####### backtest ####### This is a function conducting backtesting using specific strategy function results ## input ## 1. data: historical trading data (has to be the same form of the testdata). 2. initial.time: the timepoint you start backtesting. 3. initial.money: the money you have at the initial.time (default=100). 4. rebalance: the time gay between each rebalance (default=1). 5. method: the name of strategy function,e.g. GMVP, SHARPE, PerfInd, etc (default=GMVP). 6. lower: the lower bound for the weight of each asset in the portfolio (default=0). 7. upper: the upper bound for the weight of each asset in the portfolio (default=1). 8. rf: risk free rate. If you set rf=0, the program will calculate the return rate using the return of the index/benchmark (default=0). ## output ## 1. timeset: a sequence of rebalancing time. 2. total.money: a sequence of money achieved from strategy. 3. index.money: a sequence of money achieved from investing index. 4. weight: a sequence of weight used in each rebalancing. 5. block: total number of rebalancing. 6. weighted.means: a sequence of average portfolio returns at each rebalancing time point. 7. variances: a sequence of variance of portfolio returns at each rebalancing time point. 8. index.means: a sequence of average index returns at each rebalancing time point. 9. index.variances: a sequence of variance of index returns at each reblancing time point. 10. sharpe.ratio: a sequence of sharpe.ratio of portfolio. 11. A 2 by 2 plot. ####### GMVP ####### This is a strategy function searching portfolio weights by minimizing the variance of portfolio. ## input ## 1. data: historical trading data (has to be the same form of the testdata). 2. lower: the lower bound for the weight of each asset in the portfolio (default=0). 3. upper: the upper bound for the weight of each asset in the portfolio (default=1). 4. rf: risk free rate (not necessary in GMVP) ## output ## 1. name: a sequence of asset names in the portfolio. 2. weight: the GMVP strategy weight for each asset. 3. comb: A combination of name and weight. ####### SHARPE ####### This is a strategy function searching portfolio weights by maximizing the sharpe ratio of portfolio. ## input ## 1. data: historical trading data (has to be the same form of the testdata). 2. lower: the lower bound for the weight of each asset in the portfolio (default=0). 3. upper: the upper bound for the weight of each asset in the portfolio (default=1). 4. rf: risk free rate. If you set rf=0, the program will calculate the return rate using the return of the index/benchmark (default=0). ## output ## 1. name: a sequence of asset names in the portfolio. 2. weight: the SHARPE strategy weight for each asset. 3. comb: A combination of name and weight. 4. sharpe.ratio: the maximum of sharpe ratio. 5. exdvar: excess return over variance (used as initial value of theta in PerfInd function). ####### PerfInd ####### This is a strategy functino searching portfolio weights by minimizing the Performance Index. ## input ## 1. data: historical trading data (has to be the same form of the testdata). 2. lower: the lower bound for the weight of each asset in the portfolio (default=0). 3. upper: the upper bound for the weight of each asset in the portfolio (default=1). 4. rf: risk free rate. If you set rf=0, the program will calculate the return rate using the return of the index/benchmark (default=0). ## output ## 1. name: a sequence of asset names in the portfolio. 2. weight: the PerfInd strategy weight for each asset. 3. comb: A combination of name and weight. 4. theta: estimated theta. 5. Performance.Index: estimated performance index ####### MaxDR ####### This is a strategy function searching portfolio weights by maximizing the Diversification Ratio of portfolio. ## input ## 1. data: historical trading data (has to be the same form of the testdata). 2. lower: the lower bound for the weight of each asset in the portfolio (default=0). 3. upper: the upper bound for the weight of each asset in the portfolio (default=1). 4. rf: risk free rate. If you set rf=0, the program will calculate the return rate using the return of the index/benchmark (default=0). ## output ## 1. name: a sequence of asset names in the portfolio. 2. weight: the SHARPE strategy weight for each asset. 3. comb: A combination of name and weight. 4. Diversification.Ratio: the maximum of diversification ratio.